1. Field of the Invention
The present invention relates to a calculation apparatus which executes multi-digit numerical calculation, and a storage medium in which a calculation program is stored.
2. Description of the Related Art
A conventional calculation apparatus can perform a floating point operation.
The conventional calculation apparatus employs the ANSI/IEEE 754-1958 standard (“IEEE 754”) or the like as an arithmetic standard. The conventional calculation apparatus uses a large number of digits for a precise floating point operation.
A subtraction between equivalent numerals, such as “3×√{square root over (7)}−√{square root over (63)}” or “1−1÷3×3”, must result in zero. However, as shown in FIGS. 14A and 14B, there may be a case in which the conventional calculation apparatus does not derive zero from the subtraction, even when arithmetic precision is improved by the rise of the number of digits used for the subtraction.
Further, a subtraction between very close numerals may result in extreme loss of significant digits owing to restriction on the number of digits, that is, the “cancellation” of the significant digits is brought about. In the case where the significant digits are cancelled, even when the result of the subtraction itself has almost no error, an error resulting from the cancellation may propagate and increase through subsequent calculations. For example, as shown in FIG. 15A, the values of “1+cos x”, for x=3.141593, obtained to a “15th” digit and a “19th” digit, take an equivalent value, even though several significant digits are lost. However, when the calculation results of “1+cos x” are used for calculating “(1+cos x)/x”, as shown in FIG. 15B, the calculation result obtained to the 15th digit is “1.90985910651061E−14”, while the calculation result obtained to the 19th digit is “1.909859106510614201E−14”. The more number of digits are cancelled, the error becomes more significant. Moreover, as shown in FIG. 15C, rounding-off correction is performed such that the calculation result obtained to the 15th digit is rounded off using the calculation result obtained to the 19th digit, and the calculation result obtained to the 19th digit is rounded off using a calculation result obtained to a “23rd” digit. The rounded 15-digit calculation result is “1.90985910651061E−14”, and the rounded 19-digit calculation result is “1.909860E−14”. The rounding-off correction derives much more significant errors.